? :

However, unlike the other languages, Solidity does not support

Switch and Goto statements.

Flows have to be used with precaution with enough testing as they

run many times and may lead to undesirable use and wastage or

resources or even infinite loops.

2.5.14.1 if-else Condition

Refer to the following code:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

contract IfElseContract {

function getResult(uint a, uint b, uint c) public pure

returns(uint) {

uint result;

// if else statement

if(a > b && a > c) {

result = a;

} else if(b > a && b > c){

result = b;

} else {

result = c;

}

return result;

}

}

The preceding example is an if-then-else statement. We can write

the if-else statement when the number of conditions are limited to

two.

2.5.14.2 while-do Loop

Refer to the following code: